<!doctype html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <meta charset="utf-8">
    <title>马上注册绑定A+妈妈会会员账号，尊享360°孕育礼遇</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta name="format-detection" content="telephone=no">
    <style>
        html, body{ margin:0px; height:100%; background:#FFF; }
        body{ font-family:"microsoft yahei"; font-size:16px; line-height:20px; color:#4a4a4a; }
        ul, li, dl, dt, dd, h1, h2, h3, h4, h5, p, form, em, span, img, section{ margin:0; padding:0; }
        a{ text-decoration:none; color:#4a4a4a; outline:none; }
        a:hover{ text-decoration:none; color:#666; outline:none; }
        table{ margin-bottom:10px; border-collapse:collapse; display:table; width:100% !important; }
        .main{ max-width:640px; margin:0 auto; position:relative; word-break:break-all; overflow:hidden; }
        .detailTit{ border-left:5px solid #c92621; margin-top:10px; padding:0 12px; }
        .detailInfBox *{ max-width:100% !important; box-sizing:border-box !important; -webkit-box-sizing:border-box !important; word-wrap:break-word !important; }
        .detailInfBox{ padding:12px; }
        .detailInfBox p img{ max-width:100%; }
        .detailInf{ line-height:24px; margin-top:12px; margin-bottom:60px; word-break:break-all; word-wrap:break-word; }
        .detailInfBox li{ word-wrap:break-word; }
        .input{ height:25px; margin:4px 4px; width:220px; border:1px solid #a9aaab; }
        .sbt{ padding:0 8px; font-size:16px; height:28px; line-height:28px; text-align:center; display:inline-block; color:#ffffff; font-size:12px; border:0; cursor:pointer }
        .bg_orange{ background:#be9634 }
        .c_img{ width:40px; height:25px; vertical-align:middle; cursor:pointer; }
        .cursor{ cursor:pointer }
    </style>
</head>
<body>
<div class="main">
    <header class="detailTit">
        <h2 style="font-size:20px;">马上注册绑定A+妈妈会会员账号，尊享360°孕育礼遇</h2>
        <p>2015-11-29 19:37:46</p>
    </header>
    <section class="detailInfBox">
        <p>
            <span style="font-size:16px;">点击下图“</span>
            <a href="javascript:register();">
                <span style="font-size:16px;"><strong><span style="font-size:16px;color:#0070c0;">立即注册</span></strong></span>
            </a>
            <span style="font-size:16px;">”按钮，马上加入美赞臣</span><span style="font-size:16px;">A+</span><span style="font-size:16px;">妈妈会，尊享</span><span style="font-size:16px;">360</span><span style="font-size:16px;">°孕育礼遇！</span>
        </p>
        <p>
            <a href="javascript:register();">
                <img src="http://my.erpcoo.com/Uploads/Ueditor/image/20151015/1444897700718365.jpg"/>
            </a>
        </p>
    </section>
    <div id="register" style="display:none;">
        <div style="padding:20px 20px;width:260px;">
            <div style="text-align:center;font-size:16px;">请填写您的信息</div>
            <div style="font-size:12px;">　*为必填</div>
            <div>* <input id="mobile" name="mobile" type="text" placeholder="请输入手机号码" class="input"/></div>
            <div>* <input id="captcha" name="captcha" type="text" placeholder="验证码" class="input" style="width:128px;"/> <img id="captcha_img" src="./captcha.php" class="c_img"> <span class="get_mcode sbt bg_orange cursor">获取</span></div>
            <div>* <input id="mcode" name="mcode" type="text" placeholder="手机验证码" class="input"/></div>
            <div>* <input id="name" name="name" type="text" placeholder="姓名" class="input"/></div>
            <div>* <input id="birthday" name="birthday" type="date" placeholder="预产期/宝宝生日" class="input"/></div>
            <div style="font-size:12px;">　预产期或者宝宝的生日</div>
            <div>* <input id="code" name="code" type="text" placeholder="12345" class="input"/></div>
            <div style="font-size:12px;">　如没有指定代码，您可填写12345</div>
            <div>* <input id="question" name="question" type="text" placeholder="宝宝奶粉关注的问题" class="input"/></div>
            <div>* <input id="brand" name="brand" type="text" placeholder="正在给宝宝使用的品牌" class="input"/></div>
            <div>&nbsp;</div>
            <div style="font-size:14px;text-align:center;"><input id="agree" name="agree" checked type="checkbox"> 我愿意同时成为美赞臣会员，愿意接受来自美赞臣公司的资讯</div>
            <div style="text-align:center;"><span class="register sbt bg_orange" style="height:30px;width:60%;margin-top:10px;"/>立即注册</span></div>
        </div>
    </div>
</div>
<script src="./js/layer.js"></script>
<script src="./js/lib.js"></script>
<script>
    var html = '';
    if(html == ''){
        html = $('#register').html();
        $('#register').html('');
    }
    function register(){
        layer.open({
            type: 1,
            content: html,
        });
        $('#captcha_img').click(function(){
            $(this).attr('src', './captcha.php?r' + Math.random() * 99999);
        });
        $('.get_mcode').click(function(){
            if($('.get_mcode').html() != '获取'){
                return;
            }
            var mobile = $('#mobile').val();
            var captcha = $('#captcha').val();
            if(mobile == ''){
                $('#captcha_img').attr('src', './captcha.php?r' + Math.random() * 99999);
                myAlert('请填写手机号码！');
                return;
            }
            if(!isMobile(mobile)){
                $('#captcha_img').attr('src', './captcha.php?r' + Math.random() * 99999);
                myAlert('手机号码的格式错误！');
                return;
            }
            if(captcha == ''){
                $('#captcha_img').attr('src', './captcha.php?r' + Math.random() * 99999);
                myAlert('请填写验证码');
                return;
            }
            if(captcha.length != 4){
                $('#captcha_img').attr('src', './captcha.php?r' + Math.random() * 99999);
                myAlert('验证码的长度不正确');
                return;
            }
            $.ajax({
                type: "POST",
                url: 'service.php?act=checkSms',
                data: {
                    'mobile': mobile,
                    'captcha': captcha
                },
                dataType: 'json',
                success: function(msg){
                    $('#captcha_img').attr('src', './captcha.php?r' + Math.random() * 99999);
                    if(msg.success){
                        myAlert(msg.msg)
                        $('.get_mcode').html(60);
                        wait();
                        return;
                    }else{
                        myAlert(msg.error)
                        return;
                    }
                }
            });
            function wait(){
                var wait = setInterval(function(){
                    var s = parseInt($('.get_mcode').html());
                    if(s > 0){
                        $('.get_mcode').html(s - 1);
                    }else{
                        clearInterval(wait);
                        $('.get_mcode').html('获取')
                    }
                }, 1000);
            }
        });
        $('.register').click(function(){
            var p = {};
            p['mobile'] = $('#mobile').val();
            p['mcode'] = $('#mcode').val();
            p['name'] = $('#name').val();
            p['birthday'] = $('#birthday').val();
            p['code'] = $('#code').val();
            p['question'] = $('#question').val();
            p['brand'] = $('#brand').val();
            if(!$('#agree').prop('checked')){
                myAlert('您没有接受成为美赞臣会员！');
                return;
            }
            $.ajax({
                type: "POST",
                url: 'service.php?act=register',
                data: p,
                dataType: 'json',
                success: function(msg){
                    $('#captcha').attr('src', './captcha.php?r' + Math.random() * 99999);
                    if(msg.success){
                        myAlert(msg.msg)
                        $('.get_mcode').html(60);
                        wait();
                        return;
                    }else{
                        myAlert(msg.error)
                        return;
                    }
                }
            });
        });
    }
    $(function(){
    })
</script>
</body>
</html>
